/*
Chris McLaughlin	
Proposal title: What fosters patients' acceptance of Clinical Decision Support Systems? The influence of knowledge and provider type on popular willingness to use artificial medical intelligence


HYPOTHESES

Stated-Hyp1: "Will knowledge of its accuracy increase public support for CDSS?"

	Test-Hyp1: Acceptability for the outcome in presence of CDSS will be higher when CDSS has higher accuracy than doctor vs. when accuracy is equal to doctor.
	[Within cases when CDSS accuracy information is provided; vignette 1]

Stated-Hyp2: "Does the CDSS user influence patient perception of CDSS?"

	Test-Hyp2: Acceptability for the outcome in presence of CDSS will be different for medic vs. doctor. [Vignette 2; CDSS present]

Stated-Hyp3: "We predict higher physician quality ratings in the superior CDSS condition than in the CDSS equal and no CDSS conditions for most scenarios." [Vignette 1]

	Test-Hyp3: Physican quality rating will be higher in superior CDSS condition vs. equal CDSS condition. [Vignette 1]
	
	Test-Hyp4: Physican quality rating will be higher in superior CDSS condition vs. no CDSS condition. [Vignette 1]


Stated-Hyp3: "When the CDSS leads to a negative outcome, we anticipate that the superior CDSS will be rated worst."	
	
	Test-Hyp5: Acceptability for the outcome in presence of CDSS will be lower for superior CDSS vs. equal CDSS, within cases with a negative outcome [Vignette 1.]	

	
Stated-Hyp4: "Defying the superior CDSS prior to a negative outcome will likely result in lower ratings of quality and outcome acceptability, and greater provider responsibility than when the equal CDSS is defied" [Vignette 1]

	Test-Hyp6: Provider quality rating will be lower when superior vs. equal CDSS is defied.
	Test-Hypx: Outcome acceptability will be lower when superior vs. equal CDSS is defied.
		// NOTE: this hypothesis entails the exact same test as hypothesis 5. Excluding this. See notes.
	
	Test-Hyp7: Provider responsibility will be lower when superior vs. equal CDSS is defied.
	
Stated-Hyp5: "We predict that “physician extenders” – that is, non-MD providers – who deviate from CDSS recommendations will be rated more severely than are physicians who deviate" [Vignette 2]

	Test-Hyp8: The negative effect of defiance on provider quality rating will be stronger for medics vs. doctors.

Stated-Hyp6: "We also predict that participants who see the superior CDSS condition will rate deviation from the CDSS more negatively in the second vignette than will participants who see the equal CDSS or no aid condition."

	Test-Hyp9: The negative effect of defiance on provider quality in V2 will be stronger on those  who saw the superior condition in v1 vs. equal/no CDSS condition.

	Test-Hyp10: The positive effect of defiance on provider responsibility in V2 will be stronger on those  saw was the superior condition in v1 vs. equal/no CDSS condition.
	
	
********************************************************************************
NOTES:

- In TH1 and TH2, we are using the outcome: In the scenario you just read, how 
acceptable was the end result?

- For stated hyp 3, we are assuming that the relevant outcome is acceptability 
of the end result (as above).

- For stated hypothesis 6, we are assuming the outcome is provider quality and 
responsibility.

- Test hypotheses 5 and 7 entail the same test because all cases of defiance are 
also cases of negative outcomes.

Discussed this in meeting on 4-30-2021; decided to exclude repeated hypothesis. 
*/

clear all
use "McLaughlin672.dta", clear

********************************************************************************

* INDICATORS OF EXPERIMENTAL MANIPULATIONS

* Vignette 1 (see quex and proposal)

	tab Vignette1
	
	* cdss
	recode Vignette1 (1/2=0 "0 No aid") (3/6=1 "1 equal") (7/10=2 "2 superior"), gen(cdss_v1)
	tab cdss_v1
	
	* superior vs. non-superiod conditions
	recode cdss_v1 (2=1) (0/1=0), gen(superior_v1)
	tab superior_v1
	
	* outcome
	recode Vignette1 (1 3 5 7 9=0 "0 positive") (2 4 6 8 10=1 "1 negative"), gen(outcome_v1)
	tab outcome_v1
	
	* choice 
	recode Vignette1  (1/2=.) (3 5 7 9=0 "0 heed") (4 6 8 10=1 "1 defy"), gen(choice_v1)
	tab choice_v1

	tab outcome_v1 choice_v1 // outcome is always negative when provider defied
	
* Vignette 2 (see quex and proposal)

	tab Vignette2
	
	* provider
	recode Vignette2 (1/6=1 "1 Medic") (7/12=0 "0 Doctor"), gen(provider_v2)
	
	* cdss
	recode Vignette2 (1 2 7 8=0 "0 no aid") (3 4 5 6 9 10 11 12=1 "1 aid present"), gen(cdss_v2)
	tab cdss_v2
	
	* outcome
	recode Vignette2 (1 3 4 7 9 10=0 "0 positive") (2 5 6 8 11 12=1 "1 negative"), gen(outcome_v2)
	tab outcome_v2
	
	* choice 
	recode Vignette2 (1 2 7 8=.) (3 5 9 11=0 "0 heed") (4 6 10 12=1 "1 defy"), gen(choice_v2)
	tab choice_v2
	
	
* OUTCOME MEASURES

* Vignette 1 (see quex and proposal)
	
	* doctor quality
	tab Q1A
	replace Q1A=. if Q1A==-1
	clonevar quality_v1=Q1A
	tab quality_v1

	* how acceptable was the end result?
	tab Q1B
	replace Q1B=. if Q1B==-1
	clonevar acceptable_v1=Q1B
	tab acceptable_v1	

	* how responsible was the doctor for the end result?
	tab Q1C
	replace Q1C=. if Q1C==-1
	clonevar responsible_v1=Q1C
	tab responsible_v1		

* Vignette 2 (see quex and proposal)
	
	* medic/doctor quality
	replace Q2A=. if Q2A==-1
	clonevar quality_v2 = Q2A
	tab quality_v2	
	
	* how acceptable was the end result?
	tab Q2B
	replace Q2B=. if Q2B==-1
	clonevar acceptable_v2=Q2B
	tab acceptable_v2		

	* how responsible was the doctor/medic for the end result?
	tab Q2C
	replace Q2C=. if Q2C==-1
	clonevar responsible_v2=Q2C
	tab responsible_v2		
	
********************************************************************************
* ANALYSIS
	

*	Test-Hyp1: Acceptability for the outcome in presence of CDSS will be higher when CDSS has higher accuracy than doctor vs. when accuracy is equal to doctor. [Within cases when CDSS accuracy information is provided; vignette 1]	
	reg acceptable_v1 i.cdss_v1 if cdss_v1!=0
	// reject. 0.568
	tess 2.cdss_v1 +, init(McLaughlin672) bonf(2)
	
*	Test-Hyp2: Acceptability for the outcome in presence of CDSS will be different for medic vs. doctor. [Vignette 2]
	reg acceptable_v2 i.provider_v2 if cdss_v2!=0
	// reject. 0.601
	tess 1.provider_v2
	
*	Test-Hyp3: Physican quality rating will be higher in superior CDSS condition vs. equal CDSS condition. [Vignette 1]
	reg quality_v1 i.cdss_v1 if cdss_v1!=0
	// do not reject. 0.013
	tess 2.cdss_v1 +, bonf(2)
	
*	Test-Hyp4: Physican quality rating will be higher in superior CDSS condition vs. no CDSS condition. [Vignette 1]	
	reg quality_v1 i.cdss_v1 if cdss_v1!=1
	// reject. 0.207
	tess 2.cdss_v1 +
	
*	Test-Hyp5: Acceptability for the outcome in presence of CDSS will be lower for superior CDSS vs. equal CDSS, in cases with a negative outcome [Vignette 1.]	
	reg acceptable_v1 i.cdss_v1 if outcome_v1==1 & cdss_v1!=0
	// reject. 0.476
	tess 2.cdss_v1 -
	
*	Test-Hyp6: Provider quality rating will be lower when superior vs. equal CDSS is defied.
	reg quality_v1 i.cdss_v1 if cdss_v1!=0 & choice_v1==1
	// reject. 0.463
	tess 2.cdss_v1 -, bonf(2)	

*	Test-Hyp7: Provider responsibility will be lower when superior vs. equal CDSS is defied.
	reg responsible_v1 i.cdss_v1 if cdss_v1!=0 & choice_v1==1
	// reject. 0.933
	tess 2.cdss_v1 -, bonf(2)
	
*	Test-Hyp8: The negative effect of defiance on provider quality rating will be stronger for medics vs. doctors.	
	reg quality_v2 i.provider_v2##i.choice_v2
	// reject. 0.146
	tess 1.provider_v2#1.choice_v2 -
		
*	Test-Hyp9: The negative effect of defiance on provider quality in V2 will be stronger on those  who saw the superior condition in v1 vs. equal/no CDSS condition.
	reg quality_v2 i.choice_v2##i.superior_v1
	// reject. 0.138.
	tess 1.superior_v1#1.choice_v2 -, bonf(2)		
	
*	Test-Hyp10: The positive effect of defiance on provider responsibility in V2 will be stronger on those  saw was the superior condition in v1 vs. equal/no CDSS condition.
	reg responsible_v2 i.choice_v2##i.superior_v1
	// reject. 0.809.
	tess 1.superior_v1#1.choice_v2 +, bonf(2)		
